//
//  SwiftUIView_Gradients.swift
//  SwiftUIPractice
//
//  Created by 变色龙 (external - Project) on 2024/8/12.
//

import SwiftUI

struct SwiftUIView_Gradients: View {
    var body: some View {
        Text("渐变")

        RoundedRectangle(cornerRadius: 20)
            
        //添加一个线性渐变   //更改起始点 .top  .bottom   .topLeading
//            .fill(LinearGradient(gradient: Gradient(colors: [Color.red, Color.blue]), startPoint: .leading, endPoint: .trailing))

        //添加一个径向渐变
//            .fill(RadialGradient(gradient: Gradient(colors: [Color.red, Color.blue]),
//                                 center: .center,  //这个起始角度是可以改的  .topLeading
//                                 startRadius: 5, endRadius: 200 ))
//        
        
        //添加一个角度渐变
            .fill(AngularGradient(gradient: Gradient(colors: [Color.red, Color.blue]), center: .center, angle: .degrees(45)))
          
            .frame(width: 300, height: 200)
        
    }
}

#Preview {
    SwiftUIView_Gradients()
}
